feat(pgxpool): acquire ping timeout#2393
Merged
Merged
Conversation
de5cf1b to
6a68d67
Compare
Contributor
Author
|
@jackc the PR is final could you please review this. |
ef422db to
76d013d
Compare
this commit adds ping timeout in acquire loop for when the connection ping results in timeout instead of an error
76d013d to
c1c74da
Compare
Owner
|
The code looks reasonable but it seems the test is flickering. |
6e7a097 to
436656d
Compare
436656d to
0f61c88
Compare
Contributor
Author
|
@jackc thanks for the review, I think I fixed the flickering, I added a proxy interface simulating real delay (using sleep) to ensure |
Owner
|
Thanks! |
redbaron
reviewed
Nov 6, 2025
| if p.pingTimeout > 0 { | ||
| var cancel context.CancelFunc | ||
| pingCtx, cancel = context.WithTimeout(ctx, p.pingTimeout) | ||
| defer cancel() |
Contributor
There was a problem hiding this comment.
this defer inside for loop can accumulate unnecessary
Contributor
Author
There was a problem hiding this comment.
Yeah, it will be better if handled at the end of the loop, but I don't think it has an overhead does it? Just the order of executions changes. The defer struct without any arguments is very lightweight as I remember
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
this commit adds ping timeout in acquire loop for when the connection ping results in timeout instead of an error